package com.yf.cl;

import sun.misc.Launcher;

import java.net.URL;
import java.security.Provider;

public class BootstrapClassLoaderTest {
    public static void main(String[] args) {
        URL[] urLs = Launcher.getBootstrapClassPath().getURLs();
        for (URL url : urLs) {
            System.out.println(url.toExternalForm());
            /*
            file:/D:/lib/java/jdk1.8.0_151/jre/lib/resources.jar
            file:/D:/lib/java/jdk1.8.0_151/jre/lib/rt.jar
            file:/D:/lib/java/jdk1.8.0_151/jre/lib/sunrsasign.jar
            file:/D:/lib/java/jdk1.8.0_151/jre/lib/jsse.jar
            file:/D:/lib/java/jdk1.8.0_151/jre/lib/jce.jar
            file:/D:/lib/java/jdk1.8.0_151/jre/lib/charsets.jar
            file:/D:/lib/java/jdk1.8.0_151/jre/lib/jfr.jar
            file:/D:/lib/java/jdk1.8.0_151/jre/classes
             */
        }

        // 用解压软件打开jsse.jar，jsse.jar\com\sun\net\ssl\internal\ssl\Provider.class
        ClassLoader classLoader = Provider.class.getClassLoader();
        System.out.println(classLoader); // null表示类加载器为引导类加载器

        /*
        引导类加载器是jvm自带的，由C/C++实现，无法通过java代码获取
         */
    }
}
